package com.checkcode.kaptcha;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class SubmitServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		response.setContentType("text/html; charset=UTF-8");
		//获取验证码的值
		String k = (String) session
				.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
		//获取输入框的值
		String str = request.getParameter("kaptcha");
		PrintWriter out = response.getWriter();
		if (k.equals(str))
			out.print("true");
		else
			out.print("false");
		out.write("<br/><a href='kaptcha.jsp'>return</a>");
	}

}
